<template>
	<gui-page ref="guiPage" :customHeader="true">
		<template v-slot:gHeader>
			<nav-bar-custom left-icon="left" :title="$t('distributedEnter.scanRecord')"></nav-bar-custom>
		</template>
		<template v-slot:gBody>
			<view v-if="data.scanList.length==0" class="noticeHooks">
				{{data.scanList.length == 0 ? $t('stockManage.notAvailable') : $t('stockManage.without')}}
			</view>
			<view v-for="(item,index) in data.scanList" :key="`${item.barcode}` + `${index}`" class="record-card" v-else>
				<uni-icons class="close-icons" type="closeempty" color="#9C9C9C" size="30" @click="handelClosePopup(index,item)"></uni-icons>
				<view class="card-mini-head">
					<view class="title-line"></view>
					<text>{{$t('translationImage.serialNumber')}}：{{index+1}}</text>
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('distributedOut.barcode')}}：</text>{{item.barcode}}
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('distributedEnter.materialCode')}}：</text>{{item.materialCode}}
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('distributedEnter.materialName')}}：</text>{{item.materialName}}
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('distributedEnter.materialSpec')}}：</text>{{item.materialSpec}}
				</view>
				<!-- <view class="custom-card-itemOne">
					<text class="item-info-title">条码总数：</text>{{item.currentQty}}
				</view> -->
				<view class="custom-card-itemOne" style="font-weight: 600;">
					<text class="item-info-title" style="color:#dd524d">{{$t('purchaseReturn.rejectedMaterialQty')}}：</text>{{item.currentQty}}
				</view>
			</view>
		</template>
	</gui-page>
</template>

<script setup>
	import { navigate } from '@/utils/routerSkip.js';
	import { useStore } from "vuex";
	import {
		computed,
		reactive,
		onMounted
	} from 'vue';
	import { basPdaOperationLogFn } from '@/utils/index.js';
	import { OPERATION_DEL, OPERATION_LOOK } from '@/constant/index.js'
	let data = reactive({
		scanList:[],
	})
	let store = useStore();
	// fqc扫描条码
	data.scanList = computed(() => {
		return store.state.stockManage.wmsReturnScanList
	})
	onMounted(() => {
		try {
			let inputParameter = '无'
			let returnParameter = JSON.stringify(data.scanList)
			let operationPicture = '采购退料'
			let callInterface = '无'
			let opertionParmes = {
				inputParameter,
				returnParameter,
				operationPicture,
				callInterface,
				responseCode:'无',//返回状态
				errorMessage:'无',//错误信息
				isPass:'Y',//是否成功 Y N
				operationType:OPERATION_LOOK,
				module: 'WMS',
				source: "PDA",
			}
			basPdaOperationLogFn(opertionParmes)
		} catch (error) {
		}
	})
	const handelClosePopup = (index,item) => {
		try {
			let inputParameter = '无'
			let returnParameter = JSON.stringify(item)
			let operationPicture = '采购退料'
			let callInterface = '无'
			let opertionParmes = {
				inputParameter,
				returnParameter,
				operationPicture,
				callInterface,
				responseCode:'无',//返回状态
				errorMessage:'无',//错误信息
				isPass:'Y',//是否成功 Y N
				operationType:OPERATION_DEL,
				module: 'WMS',
				source: "PDA",
			}
			basPdaOperationLogFn(opertionParmes)
		} catch (error) {
		}
		store.dispatch('stockManage/delWmsReturnScanListItem', index)
	}
	
</script>

<style>

</style>
